<?php

namespace DP\EventBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * DP\EventBundle\Entity\Event
 *
 * @ORM\Table(name="dp_event")
 * @ORM\Entity(repositoryClass="DP\EventBundle\Entity\EventRepository")
 */
class Event
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var text $description
     *
     * @ORM\Column(name="description", type="text")
     * @Assert\NotBlank()
     */
    private $description;

    /**
     * @var datetime $date_debut
     *
     * @ORM\Column(name="date_debut", type="datetime")
     * @Assert\DateTime()
     */
    private $date_debut;

    /**
     * @var datetime $date_fin
     *
     * @ORM\Column(name="date_fin", type="datetime")
     * @Assert\DateTime()
     */
    private $date_fin;

    /**
     * @var datetime $date_publication
     *
     * @ORM\Column(name="date_publication", type="datetime")
     * @Assert\DateTime()
     */
    private $date_publication;

    /**
     * @var string $titre
     *
     * @ORM\Column(name="titre", type="string", length=255)
     * @Assert\MinLength(limit=10, message="Le titre doit faire au moins {{ limit }} caractères.")
     */
    private $titre;

    /**
     * @var string $soustitre
     *
     * @ORM\Column(name="soustitre", type="string", length=255, nullable=true)
     */
    private $soustitre;

    /**
    * @ORM\ManyToOne(targetEntity="DP\UserBundle\Entity\User")
    * @ORM\JoinColumn(nullable=false)
    */
    private $user;
    
    /**
     * @ORM\ManyToMany(targetEntity="DP\EventBundle\Entity\Tag")
     * @Assert\Valid()
     */
    private $tags;
    
    public function __construct() 
    {
    	$this->date_debut = new \Datetime();
    	$this->date_fin = new \Datetime();
    	$this->date_publication = new \Datetime();
    	$this->tags = new ArrayCollection();
    }
    
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set description
     *
     * @param text $description
     */
    public function setDescription($description)
    {
        $this->description = $description;
    }

    /**
     * Get description
     *
     * @return text 
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set date_debut
     *
     * @param datetime $dateDebut
     */
    public function setDateDebut($dateDebut)
    {
        $this->date_debut = $dateDebut;
    }

    /**
     * Get date_debut
     *
     * @return datetime 
     */
    public function getDateDebut()
    {
        return $this->date_debut;
    }

    /**
     * Set date_fin
     *
     * @param datetime $dateFin
     */
    public function setDateFin($dateFin)
    {
        $this->date_fin = $dateFin;
    }

    /**
     * Get date_fin
     *
     * @return datetime 
     */
    public function getDateFin()
    {
        return $this->date_fin;
    }

    /**
     * Set date_publication
     *
     * @param datetime $datePublication
     */
    public function setDatePublication($datePublication)
    {
        $this->date_publication = $datePublication;
    }

    /**
     * Get date_publication
     *
     * @return datetime 
     */
    public function getDatePublication()
    {
        return $this->date_publication;
    }

    /**
     * Set titre
     *
     * @param string $titre
     */
    public function setTitre($titre)
    {
        $this->titre = $titre;
    }

    /**
     * Get titre
     *
     * @return string 
     */
    public function getTitre()
    {
        return $this->titre;
    }

    /**
     * Set soustitre
     *
     * @param string $soustitre
     */
    public function setSoustitre($soustitre)
    {
        $this->soustitre = $soustitre;
    }

    /**
     * Get soustitre
     *
     * @return string 
     */
    public function getSoustitre()
    {
        return $this->soustitre;
    }

    /**
     * Set user
     *
     * @param DP\UserBundle\Entity\User $user
     */
    public function setUser(\DP\UserBundle\Entity\User $user)
    {
        $this->user = $user;
    }

    /**
     * Get user
     *
     * @return DP\UserBundle\Entity\User 
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Add tags
     *
     * @param DP\EventBundle\Entity\Tag $tags
     */
    public function addTag(\DP\EventBundle\Entity\Tag $tags)
    {
        $this->tags[] = $tags;
    }

    /**
     * Get tags
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getTags()
    {
        return $this->tags;
    }
}